<%@ page import="java.util.Date" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Random" %>
<html>
	<p><b>Session Id:</b> <%=session.getId()%></p>
	<p><b>New:</b> <%=session.isNew()%></p>
	<p><b>Created:</b> <%=new Date(session.getCreationTime())%></p>
	<p><b>Last:</b> <%=new Date(session.getLastAccessedTime())%></p>
	<p><b>Max Inactive:</b> <%=session.getMaxInactiveInterval()%></p>
	<p><b>Context:</b> <%=session.getServletContext()%></p>
	<%!
	 
	  public static String getRandomString(int length) { 
		 String base = "abcdefghijklmnopqrstuvwxyz0123456789"; 
		 Random random = new Random();   
		 StringBuffer sb = new StringBuffer();   
		 for ( int i = 0; i < length; i++ ) {   
		    int number = random.nextInt(base.length());   
		    sb.append(base.charAt(number));   
		 }   
		 return sb.toString();   
	 }
	 
	%>
	<%
	
      if ( session.isNew() ){	
	       HashMap< String,String > map= new HashMap< String,String >();
	       for ( int i = 0; i < 100; i++){
	          map.put( "" + (i + 1) , getRandomString(20) );
	       }
	       
	       session.setAttribute("map", map);
	  }
	
	%>
	<p><b>Attribute map:</b> <%=session.getAttribute("map")%></p>
	
	<b><a href="http://192.168.0.185/test">Balance URL</a></b>
	
</html>